<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
	<head>
		<title>留言交互</title>
		<script type="text/javascript">
			$(document).ready(function(){
				$("#commentForm").validationEngine({
					promptPosition : "centerRight"
				});
			});  
		</script>
	</head>
	<body>
		<c:forEach var="comment" items="${comments }">
			<table cellpadding="0" cellspacing="5" style="width: 70%;margin-bottom: 10px;">
				<tr>
					<td style="width: 30%;">
						<c:choose>
							<c:when test="${'ROLE_ADVISER' eq comment.user.mainRole.name }">留学顾问：</c:when>
							<c:when test="${'ROLE_EDITOR_IN_CHIEF' eq comment.user.mainRole.name }">专业顾问：</c:when>
							<c:when test="${'ROLE_USER' eq comment.user.mainRole.name }">用户：</c:when>
						</c:choose>
						<span style="color: #F06E00;">${comment.user.name }</span>
					</td>
					<td>
						<span style="color: #F06E00;"><fmt:formatDate value="${comment.replyTime }" pattern="yyyy-MM-dd HH:MM"/></span>
					</td>
				</tr>
				<tr>
					<td>
						上传文书：<a href="${ctx }/download.html?id=${comment.id }&type=${param.ownerType }">${comment.attachmentName }</a>
					</td>
					<td>
						备注：<span style="color: #F06E00;">${comment.content }</span>
					</td>
				</tr>
			</table>
			<hr style="border-color: #F06E00;border-style: dashed;margin-bottom: 5px;">
		</c:forEach>
		<form id="commentForm" action="${ctx }/saveComment.html" method="post" enctype="multipart/form-data">
			<input type="hidden" id="owenId" name="ownerId" value="${param.ownerId }">
			<input type="hidden" id="owenType" name="ownerType" value="${param.ownerType }">
			<table cellpadding="0" cellspacing="5">
				<tr>
					<td>
						<textarea id="content" name="content" class="validate[required] textarea"></textarea>
					</td>
				</tr>
				<tr>
					<td>
						<input type="file" id="upload" name="upload" size="35" onkeydown="return false" />		
					</td>
				</tr>
				<tr>
					<td>
						<input type="submit" value="发表" class="submit" />
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>
